<template>
    <div id="containerDiv">
       
    </div> 
</template>
<script>

export default {
    name:"Home",
    data(){
        return { 
            
        }
    },
    methods:{
       
    },

    mounted(){
        //测试bim核心类库
        var dom = document.getElementById('containerDiv');
        let viewer = new BIMI.BimViewer(dom,{localCache:false,navCube:true,loading:true,loadProperty:true});
        //设计协同常用UI
        let toolbar = new BIMI.Toolbar(viewer);
        //加载bim模型
        viewer.load('rac_basic_sample_project/bim.bin');
        //加载glb模型
        //viewer.loadGLTF('glb/ferrari.glb',{location:new BIMI.THREE.Vector3(0,8,0),updateRegion:true});
        //测试viewer事件
		viewer.on(BIMI.ViewerEvent.LOADED, model => {
			console.info(model)
		});
		viewer.on(BIMI.ViewerEvent.PICK,(event)=>{
			this.modelId = event.data[0].modelId;
			var product = viewer.getProduct(event.data[0].modelId,event.data[0].productId);
			console.info(product);
		})
		viewer.on(BIMI.ViewerEvent.DBL_CLICK,(event)=>{
			console.info(event.data);
			viewer.zoomToProduct(event.data[0].modelId,event.data[0].productId,true);
		})
			
		viewer.on(BIMI.ViewerEvent.CONTEXT_MENU,event=>{
			console.info(event)
		})
    },
    beforeDestroy() {
        let viewer = BIMI.ViewerHelper.getViewer();
        if(viewer)
        {
            viewer.dispose();
        }
    }
  
}
</script>
<style scoped>
    .btnDiv{
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 1000;
    }
</style>


